﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Vds2465Telegrams;

namespace Vds2465Parser
{
	[TestClass]
	public class Generator_RESPOND_NDAT_GenerateAndParse_Test
	{
		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test10_StateQuery()
		{
			// first generate bytes
			UserData_10_Query userData10 = new UserData_10_Query(UserData.UserData20State, 0x34, 0x34, 0x23, (byte)eAddressExtension_1.Input);
			UserDataColl userDataColl = new UserDataColl();
			userDataColl.Add(userData10);

			Telegram_Returning_RESPOND_NDAT telegramReturningRespondNdat = new Telegram_Returning_RESPOND_NDAT(eDirection.RCT_to_ACE, 0x07, true, true, userDataColl);

			IGeneratorParser generatorParser = Helpers.GetGeneratorParser();
			byte[] telegramBytes = generatorParser.GenerateTelegramBytes(telegramReturningRespondNdat);

			// second parse the generated bytes
			Telegram telegramParsed = generatorParser.ParseTelegramBytes(telegramBytes);
			Assert.IsNotNull(telegramParsed);
			Assert.IsTrue(telegramReturningRespondNdat.Equals(telegramParsed));
		}
	}
}
